home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / Dmod / dmod_P96 / examples / BestModeID.d next >
Encoding:
Text File  |  2002-10-28  |  2.0 KB  |  65 lines

  1. /***********************************************************************
  2. * This is example shows how to use p96BestModeIDTagList()
  3. *
  4. * tabt (Mon Aug 28 14:07:40 1995)
  5. *
  6. * converted by Martin <MarK> Kuchinka, 13.9.2001
  7. ***********************************************************************/
  8.  
  9. MODULE    'picasso96','libraries/picasso96','graphics/modeid'
  10.  
  11. DEF    fmts[RGBFB_MaxFormats]=[
  12.         'RGBFB_NONE',
  13.         'RGBFB_CLUT',
  14.         'RGBFB_R8G8B8',
  15.         'RGBFB_B8G8R8',
  16.         'RGBFB_R5G6B5PC',
  17.         'RGBFB_R5G5B5PC',
  18.         'RGBFB_A8R8G8B8',
  19.         'RGBFB_A8B8G8R8',
  20.         'RGBFB_R8G8B8A8',
  21.         'RGBFB_B8G8R8A8',
  22.         'RGBFB_R5G6B5',
  23.         'RGBFB_R5G5B5',
  24.         'RGBFB_B5G6R5PC',
  25.         'RGBFB_B5G5R5PC'
  26.     ]:PTR
  27.  
  28. DEF    P96Base
  29.  
  30. PROC main()
  31.     IF P96Base:=OpenLibrary(P96NAME,2)
  32.         DEFUL    DisplayID
  33.         DEFL    width=640,
  34.                 height=480,
  35.                 depth=24
  36.  
  37.         DEF    ra,array=[0,0,0,0]:L
  38.         IF ra:=ReadArgs('Width=W/N,Height=H/N,Depth=D/N',array,NIL)
  39.             IF array[0] THEN width :=^array[0]
  40.             IF array[1] THEN height:=^array[1]
  41.             IF array[2] THEN depth :=^array[2]
  42.             FreeArgs(ra)
  43.         ENDIF
  44.  
  45.         IF DisplayID:=p96BestModeIDTags(
  46.                                         P96BIDTAG_NominalWidth,     width,
  47.                                         P96BIDTAG_NominalHeight,    height,
  48.                                         P96BIDTAG_Depth,            depth,
  49.                                         P96BIDTAG_FormatsForbidden, RGBFF_R5G5B5|RGBFF_R5G5B5PC|RGBFF_B5G5R5PC,
  50.                                         TAG_DONE)
  51.             PrintF('DisplayID: $\h\n', DisplayID)
  52.             IF DisplayID<>INVALID_ID
  53.                 PrintF('Width: %ld\n',         p96GetModeIDAttr(DisplayID, P96IDA_WIDTH))
  54.                 PrintF('Height: %ld\n',        p96GetModeIDAttr(DisplayID, P96IDA_HEIGHT))
  55.                 PrintF('Depth: %ld\n',         p96GetModeIDAttr(DisplayID, P96IDA_DEPTH))
  56.                 PrintF('BytesPerPixel: %ld\n', p96GetModeIDAttr(DisplayID, P96IDA_BYTESPERPIXEL))
  57.                 PrintF('BitsPerPixel: %ld\n',  p96GetModeIDAttr(DisplayID, P96IDA_BITSPERPIXEL))
  58.                 PrintF('RGBFormat: %s\n', fmts[p96GetModeIDAttr(DisplayID, P96IDA_RGBFORMAT)])
  59.                 PrintF('Is P96: %s\n',      IF p96GetModeIDAttr(DisplayID, P96IDA_ISP96) THEN 'yes' ELSE 'no')
  60.             ENDIF
  61.         ENDIF
  62.         CloseLibrary(P96Base)
  63.     ELSE PrintF('Unable to open picasso69api.library v2+\n')
  64. ENDPROC
  65.